<%--
  Created by IntelliJ IDEA.
  User: xh
  Date: 2020/2/6
  Time: 19:18
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta charset="UTF-8">
    <title>写文章 - 技术栈 -Java程序员成长平台</title>
    <meta name="keywords" content="">
    <meta name="description" content>
    <link rel="stylesheet" href="${APP_PATH}/vendor/layui-v2.4.5/layui/css/layui.css">
    <link rel="stylesheet" href="${APP_PATH}/css/common.css">
    <link rel="stylesheet" href="${APP_PATH}/css/header.css">
    <link rel="stylesheet" href="${APP_PATH}/css/footer.css">
    <link rel="stylesheet" href="${APP_PATH}/css/question-add.css">
    <link rel="stylesheet" href="${APP_PATH}/vendor/layui-v2.4.5/layui-formSelects/dist/formSelects-v4.css">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<jsp:include page="head.jsp"></jsp:include>

<div class="layui-main g-main">
    <div class="layui-row layui-col-space30">
        <div class="layui-col-xs12">
            <form class="layui-form" action="${APP_PATH}/blog/doAdd" method="post" id="form2">
                <input type="hidden" value="${sessionScope.user.id}" name="userId" id="userId">
                <div class="layui-form-item">
                    <input type="text" name="title" id="title" placeholder="文章标题：一句话定义您的文章标题" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <select class="layui-select" xm-select="category-select" xm-select-radio name="blogType" id="blogType" placeholder="文章分类：请选择个人分类" >

                                <option value="java">java类</option>
                                <option value="c">c语言类</option>
                                <option value="c++">C++类</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <select class="layui-select" xm-select="tag-select" xm-select-radio name="systemType" id="systemType" placeholder="系统分类：请准确选择标签" >
                                <option value="windows">windows</option>
                                <option value="linux">linux</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <textarea  name="main" class="layui-textarea" placeholder="文章内容" id="main" ></textarea>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row">
                        <div class="layui-col-xs6">
                            <input type="checkbox" title="个人置顶">
                        </div>
                        <div class="layui-col-xs6 c-tr">
                            <!-- <span>保存中...</span> -->
                            <span>已保存草稿<a href="javascript:;">[舍弃]</a></span>
                            <button class="layui-btn c-ml15" onclick="add();">发布文章</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<div class="g-footer">
    <hr>
    <div>Copyright ©2018 技术栈(jishuzhan.club), All Rights Reserved.</div>
    <div>渝ICP备13001123号-2</div>
</div>

<script src="${APP_PATH}/vendor/holder.min.js"></script>
<script src="${APP_PATH}/vendor/layui-v2.4.5/layui/layui.js"></script>
<script src="${APP_PATH}/vendor/layui-v2.4.5/layui-formSelects/dist/formSelects-v4.js"></script>
<%--<script src="${APP_PATH}/js/common.js"></script>--%>
<%--<script src="${APP_PATH}/js/question-add.js"></script>--%>
<script src="${APP_PATH}/jquery/jquery-2.1.1.min.js"></script>
<script>
  function add() {
      // 获取用户数据的数据
      var title = $("#title").val();
      var blogType=$("#blogType").val();
      var systemType=$("#systemType").val();
      var main=$("#main").val();
      var userId=$("#userId")


      if(title == ''){
          layer.msg("标题不能为空！", {time: 3000, icon: 5, shift: 6}, null);
          return;
      }
      if(blogType == ''){
          layer.msg("请选择一个分类！", {time: 3000, icon: 5, shift: 6}, null);
          return;
      }
      if(systemType == ''){
          layer.msg("请选择一个分类！", {time: 3000, icon: 5, shift: 6}, null);
          return;
      }

      if(main == ''){
          layer.msg("文章不能为空", {time: 3000, icon: 5, shift: 6}, null);
          return;
      }

        $("#form2").submit();



  }
</script>
</body>
</html>
